<?php
  require "./tool_clustering.php";
  require "./tool_maths.php";

  $a=array(0,0,0);
  $b=array(2,4,0);
  $c=array(4,0,0);
  $d=array(10,10,0);
  $e=array(11,11,0);

  function sort_array_cluster(&$_array_cluster){
    ksort($_array_cluster);
    foreach($_array_cluster as $cluster){
      ksort($cluster);
    }
    
  }

  $array_pts=array($a,$b,$c,$d,$e);
//  $array_cluster=tool_clustering::run_cluster_final($array_pts);
//  print_r($array_cluster);
  $array_strong_clusters=tool_clustering::strongest_clusters($array_pts);
//  print_r($array_strong_clusters);

/*
  list($min,$max)=tool_clustering::get_corners($array_pts);
  $nb_clusters=round(log(count($array_pts)));
  $array_barycentre=tool_clustering::get_pts_start($min,$max,$nb_clusters+1);

  while(true){
    $array_cluster=tool_clustering::run_cluster($array_barycentre,$array_pts);
    $array_barycentre=array();
    foreach($array_cluster as $id_cluster=>$cluster){
      $pts=array();
      foreach($cluster as $id_pt) $pts[$id_pt]=$array_pts[$id_pt];
      $array_barycentre[$id_cluster]=tool_clustering::get_barycentre($pts); 
    } 
    sort_array_cluster($array_cluster);
    if($old_array_cluster==$array_cluster)
      break;

    $old_array_cluster=$array_cluster;
  }
  print_r($array_cluster);
*/
  
?>
